<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class Guestbook extends CI_Controller
	{
		public function __construct()
		{
            parent::__construct();
		}
		
		public function index()
		{
			$dataObj = new DataObject();
			$dataObj->SetTitle(getGuestbookViewTitle());
			$dataObj->SetContent(getGuestbookViewUrl());
			
			// Validation moved to separate file
			// Creates a new guestbook entry, views successpage
			if(!$this->form_validation->run() == FALSE)
			{
				$dataObj->SetTitle(getGuestbookViewSuccessTitle());
				$dataObj->SetContent(getGuestbookViewSuccessUrl());
				
				$this->guestbook_model->new_guestbook_entry(getGuestbookName(),getGuestbookMessage());
			}
			$dataObj->SetInformation($this->guestbook_model->get_all_guestbook());
			
			$this->load->view(index_page(), array($dataObj->GetName() => $dataObj));
			
		}
	}